//
//  GeRenJiShi.m
//  EJLX
//
//  Created by adc on 15/11/22.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "GeRenJiShi.h"
#import "TwoGeRenJiShi.h"
#import "thireGeRenJiShi.h"
@implementation GeRenJiShi
+(id)userWithDictionary:(NSDictionary*)userDic
{
    return [[self alloc]initWithDictionary:userDic];
}
-(id)initWithDictionary:(NSDictionary*)userDic
{
    self=[super init];
    if (self)
    {
    
        NSLog(@"33333%@",userDic);
       
        if ([userDic[@"avatar"]isKindOfClass:[NSNull class]])
        {
            _avatar=@"";
        }
        else
        {
             _avatar=[userDic[@"avatar"]copy];
        }

        if ([userDic[@"shopName"]isKindOfClass:[NSNull class]])
        {
           _shopName=@"";
        }
        else
        {
            _shopName=[userDic[@"shopName"]copy];
            
        }
      //  if (![_shopName  isKindOfClass:[NSNull class]])
        //{
        
        //}
        if ([userDic[@"shopId"]isKindOfClass:[NSNull class]])
        {
            _shopId=0;
        }
        else
        {
             _shopId=[userDic[@"shopId"]intValue];
        }

       
        if (![userDic[@"list"]isKindOfClass:[NSNull class]])
        {
            
            NSMutableArray*listAry=userDic[@"list"];
            
            _leftAry=[NSMutableArray array];
            _rightAry=[NSMutableArray array];
            _otherAry=[NSMutableArray array];
            NSLog(@"222222%@",listAry);
            if (listAry.count>0)
            {
                for (int i=0;i<listAry.count; i++)
                {
                    if (![listAry[i][@"adLeft"]isKindOfClass:[NSNull class]])
                    {
                        TwoGeRenJiShi*left=[TwoGeRenJiShi userWithDictionary:listAry[i][@"adLeft"]];
                        [_leftAry addObject:left];
                    }
                    if (![listAry[i][@"adRight"]isKindOfClass:[NSNull class]])
                    {
                        TwoGeRenJiShi*right=[TwoGeRenJiShi userWithDictionary:listAry[i][@"adRigh"]];
                        [_rightAry addObject:right];
                    }
                    
                    
                    thireGeRenJiShi*other=[thireGeRenJiShi userWithDictionary:listAry[i]];
                    [_otherAry addObject:other];
                }
                
            }

        }
        
        
    
    }
    return self;
}

@end
